package org.viva.cms.sitemap;
//package com.viva.sitemap;
//
//import org.apache.commons.httpclient.HttpClient;
//import org.apache.commons.httpclient.methods.PostMethod;
//import org.apache.commons.httpclient.methods.RequestEntity;
//import org.apache.commons.httpclient.methods.StringRequestEntity;
//
//public class CopyOfBaiduSm {
//
//	public String				url			= "http://data.zz.baidu.com/urls?site=www.dowdybear.com&token=X4tm1T1D2MiVCRHQ";
//
//	public static final String	BAIDU_RPC	= "http://ping.baidu.com/ping/RPC2";
//	public static final String	GOOGLE_RPC	= "http://blogsearch.google.com/ping/RPC2";
//
//	private static String buildMethodCall(String title, String url, String shareURL, String rssURL) {
//		StringBuffer buffer = new StringBuffer();
//		buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
//		buffer.append("<methodCall>");
//		buffer.append("<methodName>weblogUpdates.extendedPing</methodName>");
//		buffer.append("<params>");
//		buffer.append("<param><value><string>" + url + "</string></value></param>");
//		buffer.append("<param><value><string>" + title + "</string></value></param>");
//		buffer.append("<param><value><string>" + shareURL + "</string></value></param>");
//		buffer.append("<param><value><string>" + rssURL + "</string></value></param>");
//		buffer.append("</params>");
//		buffer.append("</methodCall>");
//		return buffer.toString();
//	}
//
//	public static String pingBaidu(String title, String url, String shareURL, String rssURL) throws Exception {
//		PostMethod post = new PostMethod(BAIDU_RPC);
//		post.addRequestHeader("User-Agent", "request");
//		post.addRequestHeader("Content-Type", "text/xml");
//		String methodCall = buildMethodCall(title, url, shareURL, rssURL);
//		RequestEntity entity = new StringRequestEntity(methodCall, "text/xml", "utf-8");
//		post.setRequestEntity(entity);
//		HttpClient httpclient = new HttpClient();
//		// httpclient.getHostConfiguration().setProxy("127.0.0.1", 8888);
//		httpclient.executeMethod(post);
//		String ret = post.getResponseBodyAsString();
//		post.releaseConnection();
//		return ret;
//	}
//
//	public static String pingGoogle(String title, String url, String shareURL, String rssURL) throws Exception {
//		PostMethod post = new PostMethod(GOOGLE_RPC);
//		post.addRequestHeader("User-Agent", "request");
//		post.addRequestHeader("Content-Type", "text/xml");
//		String methodCall = buildMethodCall(title, url, shareURL, rssURL);
//		RequestEntity entity = new StringRequestEntity(methodCall, "text/xml", "utf-8");
//		post.setRequestEntity(entity);
//		HttpClient httpclient = new HttpClient();
//		// httpclient.getHostConfiguration().setProxy("127.0.0.1", 8888);
//		httpclient.executeMethod(post);
//		String ret = post.getResponseBodyAsString();
//		post.releaseConnection();
//		return ret;
//	}
//
//	public static void main(String[] args) throws Exception {
//		String ret = CopyOfBaiduSm.pingBaidu("最代码", "http://www.zuidaima.com/", "http://www.zuidaima.com/share/1787210045197312.htm",
//				"http://www.zuidaima.com/share/rss.htm");
//		System.out.println(ret);
////		ret = BaiduSm.pingGoogle("最代码", "http://www.zuidaima.com/", "http://www.zuidaima.com/share/1787210045197312.htm",
////				"http://www.zuidaima.com/share/rss.htm");
////		System.out.println(ret);
//	}
//
//}
